<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserModelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('uid')->comment('主键ID');
            $table->string('username')->unique()->comment('用户名');
            $table->string('email')->unique()->nullable()->comment('邮箱');
            $table->string('phone')->unique()->nullable()->comment('手机号');
            $table->string('avatar')->nullable()->comment('头像地址');
            $table->string('introduce')->nullable()->comment('个人简介');
            $table->string('site')->nullable()->comment('个人网站');
            $table->string('local')->nullable()->comment('居住地');
            $table->ipAddress('created_ip')->nullable()->comment('注册IP');
            $table->ipAddress('login_ip')->nullable()->comment('登录IP');
            $table->integer('state')->default(1)->comment('用户状态0->禁用用户;1->普通用户;2->管理员;');
            $table->dateTime('login_at')->nullable()->comment('最后一次登录于');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_models');
    }
}
